import {createMap as createMap4326, getPlotLayer as getPlotLayer4326} from './EPSG-4326';
import {createMap as createMap3857, getPlotLayer as getPlotLayer3857} from './EPSG-3857';

/**
 * @Author : JiGuangJie
 * @Date : 2023/4/13
 * @Time : 下午1:41
 * @Version : 1.0.0
 * @description :
 */
const createMap = ({code, type, dom, center}: { code: string, type: string, dom: HTMLElement, center: number[] }) => {
    switch (code) {
        case EPSG_CODE['EPSG:4326']:
            return {
                map: createMap4326({
                    type,
                    dom,
                    center
                }),
                plotLayer: getPlotLayer4326()
            };
        case EPSG_CODE['EPSG:3857']:
            return {
                map: createMap3857({
                    type,
                    dom,
                    center
                }),
                plotLayer: getPlotLayer3857()
            };
        default:
            throw Error('创建地图失败');
    }
};

export {
    createMap
};